﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/include/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="${ctx}/static/h-ui/css/H-ui.min.css" />
<%@ include file="/include/header.jsp"%>
<title>查询科目类别列表</title>
</head>
<body>
	<div class="main_panel m_b20">
		<div class="ch_panel" id="queryDiv">
			<input type="hidden" data-qname="CSRFToken" id="CSRFToken" value="${csrfToken}" id="csrfToken" />
			<table class="c_table">
				<tr>
					<td>
						<button class="a_btn" id="addBtn">新增</button>
					</td>
					<td class="t_l" style="padding-left: 20px;">
						科目编码：
						<input type="text" data-qname="dicCode" id="dicCode" value="" class="input_txt" style="width: 100px" />
						&nbsp;&nbsp; 科目名称 ：
						<input type="text" data-qname="dicName" id="dicName" value="" class="input_txt" style="width: 100px" />
						&nbsp;&nbsp; 父级编码 ：
						<input type="text" data-qname="parentDicCode" id="parentDicCode" value="" class="input_txt" style="width: 100px" />
						&nbsp;&nbsp; 父级名称 ：
						<input type="text" data-qname="parentDicName" id="parentDicName" value="" class="input_txt" style="width: 100px" />
						&nbsp;&nbsp;科目分类
						<select class="input_txt" id="leiBie" name="leiBie" data-qname="leiBie" style="width: 100px">
							<option value="">--请选择--</option>
							<c:forEach items="${GET_KMFL_MAP }" var="dic">
								<option value="${dic.key }" <c:if test="${dickm.leiBie eq dic.key }">selected="selected"</c:if>>${dic.value }</option>
							</c:forEach>
						</select>
					</td>
					<td class="t_r">
						<input type="button" value="查询" id="searchBtn" class="c_btn" />
					</td>
				</tr>
			</table>
		</div>
		<table id="tbwrap" class="table table-border table-bordered table-bg m_t10 hovaertable"></table>
		<div class="page eui-pager-custom" id="j_pager"></div>
	</div>

	<script type="text/html" id="tb_template">
		<thead>
			<tr>
				<th>科目类别编码</th>
				<th>科目类别名称</th>
				<th>父级类别编码</th>
				<th>父级类别名称</th>
				<th>科目分类</th>
				<th>科目类别</th>
				<th>余额方向</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody data-type="body">
			<!if(list.length>0) { !>
				<!for(var i=0,len=list.length;i<len;i++){
					var item = list[i],classItem = (i%2!=0)?"odd td_odd":"even";
				!>
				<tr class="gradeA <!=classItem!>">
					<td><!=item["dicCode"]!></td>
					<td><!=item["dicName"]!></td>
					<td><!=item["parentDicCode"]!></td>
					<td><!=item["parentDicName"]!></td>

					<td>
						<!if(item["leiBie"]=='ZC') { !>
							资产	
						<!}else if(item["leiBie"]=='FZ') {!>
							负债
						<!}else if(item["leiBie"]=='QY') {!>
							权益
						<!}else if(item["leiBie"]=='CB') {!>
							成本
						<!}else if(item["leiBie"]=='SY') {!>
							损益
						<!}!>	
					</td>
					<td>
						<!=item["kmLbName"]!>
					</td>
					<td>
						<!if(item["yueFx"]=='1') { !>
							借
						<!}else if(item["yueFx"]=='-1') {!>
							贷
						<!}!>	
					</td>

					<td>
						<a title="详情" data-value="<!=item["uuid"]!>" class="view" style="text-decoration: none;margin-right: 10px;">
							<i class="Hui-iconfont">&#xe665;</i>
						</a>
						<a title="编辑" data-value="<!=item["uuid"]!>" class="edit" style="text-decoration: none;margin-right: 10px;">
							<i class="Hui-iconfont">&#xe6df;</i>
						</a>
						<a title="删除" data-value="<!=item["uuid"]!>" class="delete" style="text-decoration: none">
							<i class="Hui-iconfont">&#xe6e2;</i>
						</a>
					</td>
				</tr>
			<!}!>
			<!}else{!>
				<tr>
					<td colspan="10"> 暂无数据</td>
				</tr>
			<!}!>
		</tbody>
	</script>

	<script type="text/javascript">
		var dickmDialog;
		$(function() {

			//ajax请求添加等待图片
			$(document).ajaxStart(function() {
				ZENG.msgbox.show(" 正在加载中，请稍后...", 6, 8000);
			});

			$(document).ajaxComplete(function() {
				ZENG.msgbox.hide();
			});
			
			
			// 添加
			$("#addBtn").click(function() {
				parent.member_add("新增科目类别", "${ctx}/dickm/toAdd",760,300);
			});
			
			// 编辑
			$("#tbwrap").delegate(".edit", "click", function() {
				//获取主键
				var uuid = $(this).data("value");
				parent.member_add("修改科目类别", "${ctx}/dickm/toEdit?uuid="+uuid,760,300);
				
			});
			
			// 详细
			$("#tbwrap").delegate(".view", "click", function() {
				//获取主键
				var uuid = $(this).data("value");
				parent.member_add("查看科目类别", "${ctx}/dickm/view?uuid="+uuid,760,300);
			});
			
			// 4、删除
			$("#tbwrap").delegate(".delete", "click", function() {
				var uuid = $(this).data("value");
			
				if (confirm('确定删除？')) {
					$.post("${ctx}/dickm/delete", { uuid : uuid, CSRFToken : $("#CSRFToken").val()}, function(result) {
						if ("succ" == result) {
							alert("操作成功");
							// 刷新列表页面
							search();
						} else {
							alert(result);
						}
					}, "json");
				}
			
			});
			// 5、查询
			$("#searchBtn").click(function() {
				search();
			});
			
			// 页面加载完成调用查询分页
			search();
		});
	</script>

	<script type="text/javascript">
		function search() {
			// 这里放包含查询条件的DIV
			var paramData = easyUtils.getQueryDivDefault("queryDiv");

			seajs.use([ "component/table" ], function(uiTable) {
				var param = {
					url : "${ctx}/dickm/ajaxPage",
					data : paramData
				};
				easyUtils.getData(param, function(result) {
					easyUtils.buildTable(result, param, uiTable);
				});
			});
		}
	</script>
	<%@ include file="/include/footer.jsp"%>
</body>
</html>
